import nyNetwork from "@/api/nyBaseNetwork";
import DZModelPage from "@/model/DZModelPage";
import DZModelDic from "../model/DZModelDic";

class DZServiceDic {

    m_page = new DZModelPage(10);

    list_dic: Array<DZModelDic> = [];

    net_list_dic() {
        var arr_data = [];
        nyNetwork.net("职业列表", { ...this.m_page }, data => {
            this.m_page.total = data.total;
            for (const item of data.list) {
                var model = new DZModelDic();
                model.id = item.iId ?? '';
                model.name = item.sName ?? '';
                arr_data.push(model);
            }
        })
        this.list_dic = arr_data;
    }

    net_add_dic(name, success: () => void) {
        nyNetwork.net("添加职业", { name: name }, data => {
            success();
        })
    }

    net_del_dic(id, success: () => void) {
        nyNetwork.net("删除职业", { id: id }, data => {
            success();
        })
    }

}
export default DZServiceDic;